import React, {Component} from 'react';
import TakeComment from "./components/TakeComment";
import CommentOn from "./components/CommentOn";

class App extends Component{

    state = {contentList:[],pageNo:1,pageSum:0}

    //获取评论
    getCommon = async (pageNo=1,pageSize=4)=>{
        const {contentList,pageSum} = await this.$http.get('/weibo',{params:{pageNo,pageSize}})
        this.setState({contentList,pageSum,pageNo})
    }

    //组件挂载完毕时触发
    componentDidMount(){
        this.getCommon()
    }
    render(){

        return (
            <>
                <TakeComment getCommon={this.getCommon}/>
                <CommentOn getCommon = {this.getCommon} {...this.state}/>
            </>
        )
    }
}

export default App;